﻿@model List<BudgetMealsModels.Entities.Meal>
@if (Model.Count() > 0)
{
<table>
<tr><th>Name</th><th>Appetizer</th><th>Main Course</th><th>Dessert</th></tr> 
@foreach (var m in Model)
{
    <tr>
    <td>m.Name</td>
    <td>@Html.ActionLink(@m.Appetizer.Name, "ShowRecipe", "Recipe", new{Id = m.Appetizer.RecipeID}, null)</td>
    <td>@Html.ActionLink(@m.MainCourse.Name, "ShowRecipe", "Recipe", new{Id = m.MainCourse.RecipeID}, null)</td>
    <td>@Html.ActionLink(@m.Dessert.Name, "ShowRecipe", "Recipe", new{Id = m.Dessert.RecipeID}, null)</td>
    @if (Session["CurrentUser"] != null && (int)Session["CurrentUser"] == m.UserCreatedID)
    {
    <td class="CRUDbutton">
        @Html.ActionLink("Edit Meal", "Edit", new { Controller = "Meal", MealID = m.MealID })
    </td >
    <td class="CRUDbutton">
        @Html.ActionLink("Delete Meal", "Delete", new { Controller = "Meal", MealID = m.MealID })
    </td>
    }
    </tr>
}
</table>
}
else
{
    <p>No current meals!</p>
}
@Html.ActionLink("Add Meal...", "Edit", "Meal", new { userID = Session["CurrentUser"] }, null)

